package controller

import (
	"fmt"
)

func Flew() {
	x := 20
	if x > 10 {
		fmt.Println("x is greater than 10")
	} else {
		fmt.Println("x is less than 10")
	}
	//demo1()
	myFor()
}

func demo1() {

	integer := d
	if integer == 3 {
		fmt.Println("The integer is equal to 3")
	} else if integer < 3 {
		fmt.Println("The integer is less than 3")
	} else {
		fmt.Println("The integer is greater than 3")
	}

}

func myFunc() {
	i := 0
	//Here:   //这行的第一个词，以冒号结束作为标签
	println(i)
	i++
	//goto Here   //跳转到Here去
	myFunc()

}

func myFor() {
	//sum := 0
	//for index:=0; index <= 10;index++  {
	//	sum += index
	//}

	//sum := 1
	//for i := 0; sum < 1000;i++  {
	//	sum = sum + sum
	//	fmt.Println(sum)
	//}

	map1 := map[string]int{
		"math":     1,
		"engthing": 2,
	}
	for key, value := range map1 {
		fmt.Println("map's key:", key)
		fmt.Println("map's val:", value)
	}

	//i := 10
	//switch i {
	//case 1:
	//	fmt.Println("i is equal to 1")
	//case 2, 3, 4:
	//	fmt.Println("i is equal to 2, 3 or 4")
	//case 10:
	//	fmt.Println("i is equal to 10")
	//default:
	//	fmt.Println("All I know is that i is an integer")
	//}

	i := 10
	switch i {
	case 1:
		fmt.Println("haha1")
		break
	case 10:
		fmt.Println("hah2")
		break
	default:
		fmt.Println("hah2")
		break
	}

	//fmt.Println(sum)

}
